extension SubCharCode on String {
  String subOnCharacters(int start, [int? end]) {
    var runes = this.runes.toList();
    String result = '';
    int to = end ?? runes.length;
    for (var i = start; i < to; i++) {
      result = result + String.fromCharCode(runes[i]);
    }
    return result;
  }

  String subOnRunes(int start, [int? end]) {
    return String.fromCharCodes(runes.toList().sublist(start, end));
  }
}
